package com.jet.goods.gate;

import com.jet.core.result.ResultJson;
import com.jet.goods.domain.entity.GoodsSpec;
import com.jet.goods.domain.query.SpecKeyQuery;
import com.jet.goods.service.IGoodsSpecService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author dcl
 * @date 2023-02-24 13:05:35
 */
@RestController
@RequestMapping("/gate/goods/spec")
public class GateSpecController {

    private final IGoodsSpecService goodsSpecService;

    public GateSpecController(IGoodsSpecService goodsSpecService) {
        this.goodsSpecService = goodsSpecService;
    }

    @GetMapping("/list")
    public ResultJson<List<GoodsSpec>> keyList(@RequestHeader long merchantNo,
                                               @RequestHeader long storeNo,
                                               @RequestHeader String accountId,
                                               SpecKeyQuery query) {
        List<GoodsSpec> list = goodsSpecService.findAll(merchantNo, query);
        return ResultJson.ok(list);
    }
}
